<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  	<%@include file="../../../res/include/base-head.jsp"%>
	<%@include file="../../../res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/user.js"></script>
  </head>
  <body>
  	<div class="easyui-tabs">
		<div title="基本资料" style="padding:10px">
			<form id="add-form" class="dialog-data-form">
		    	<table class="data-table" cellspacing="4">
		    		<tbody>
		    			<tr>
		    				<td class="field">用户名</td>
		    				<td>
		    					<input name="name" type="text" class="field easyui-validatebox" maxlength="16"
		    						data-options="required:true"/>
		    				</td>
		    			</tr>
		    			<tr>
		    				<td class="field">密码</td>
		    				<td colspan="3">
		    					<input id="password" name="password" type="password" class="field easyui-validatebox" maxlength="16"
		    						data-options="required:true,validType:'regexp[\'^\\\\w{6,16}$\']',invalidMessage:'密码必须是6-16个字母、数字、下划线！'"/>
		    				</td>
		    			</tr>
		    			<tr>
		    				<td class="field">确认密码</td>
		    				<td colspan="3">
		    					<input type="password" class="field easyui-validatebox" maxlength="16"
		    						data-options="required:true,validType:'equals[\'#password\']',invalidMessage:'两次输入密码不一致！'"/>
		    				</td>
		    			</tr>
		    			<tr>
		    				<td class="field">管理社区:</td>
		    				<td colspan="3">
		    					省<select name="provinceId2" id="provinceId2" onchange="changeProvince2()" class="txt grid-8">
				               		<c:forEach var="province" items="${provinceList}">  
				                        <option value="${province.id}">${province.name}</option>  
				                    </c:forEach>
				               	</select>
				               	市<select name="cityId2" id="cityId2" onchange="changeCity2()" class="txt grid-8">
				               		<option value="">--请选择--</option>
				               	</select>
				               	区<select name="areaId2" id="areaId2" onchange="changeArea2()" class="txt grid-8">
				               		<option value="">--请选择--</option>
				               	</select>
								社区<select name="communityId" id="communityId2" class="txt grid-8">
				               		<option value="">--请选择--</option>
				               	</select>
		    				</td>
		    			</tr>
		    		</tbody>
		    	</table>
		   	</form>
		</div>
	</div>
<script>

$(function() {
	loadProvinceList2();
});
function loadProvinceList2(){
	var data = {}
	$.post(contextPath+'/sys/area/queryProvinceList',data,function(data) {
		if(data.code==1) {
			var values=[];
			values.push("<option value=''>--请选择--</option>");
			var list=data.map['list'];
			for(var i=0;i<list.length;i++){
				var vo=list[i];
				values.push("<option value="+vo.id+">"+vo.nameAll+"</option>");
			}
			if($("#provinceId2").length>0){
				$("#provinceId2").html(values.join(""));
			}
			if(list.length>0){
				changeProvince2();
			}
		}
	});
}

function changeProvince2(){
	var data = {provinceId:$("#provinceId2").val()}
	$.post(contextPath+'/sys/area/getCityList',data,function(data) {
		if(data.code==1) {
			var values=[];
			values.push("<option value=''>--请选择--</option>");
			var list=data.map['list'];
			for(var i=0;i<list.length;i++){
				var vo=list[i];
				values.push("<option value="+vo.id+">"+vo.nameAll+"</option>");
			}
			if($("#cityId2").length>0){
				$("#cityId2").html(values.join(""));
			}
			if(list.length>0){
				changeCity2();
			}
		}
	});
}
function changeCity2(){
	var data = {cityId:$("#cityId2").val()}
	$.post(contextPath+'/sys/area/getAreaList',data,function(data) {
		if(data.code==1) {
			var values=[];
			values.push("<option value=''>--请选择--</option>");
			var list=data.map['list'];
			for(var i=0;i<list.length;i++){
				var vo=list[i];
				values.push("<option value="+vo.id+">"+vo.nameAll+"</option>");
			}
			
			if($("#areaId2").length>0){
				$("#areaId2").html(values.join(""));
			}
			if(list.length>0){
				changeArea2();
			}
		}
	});
}

function changeArea2(){
	var data = {districtId:$("#areaId2").val()}
	$.post(contextPath+'/community/base/getListByArea',data,function(data) {
		if(data.code==1) {
			var values=[];
			values.push("<option value=''>--请选择--</option>");
			var list=data.map['list'];
			for(var i=0;i<list.length;i++){
				var vo=list[i];
				values.push("<option value="+vo.id+">"+vo.name+"</option>");
			}
			if($("#communityId2").length>0){
				$("#communityId2").html(values.join(""));
			}
		}
	});
}

</script>
  </body>
</html>
